{layout name="common/layout" /}
{css href="__PUBLIC__/admin/js/bootstrap-daterangepicker/daterangepicker.css"}
{js href="__PUBLIC__/admin/js/bootstrap-daterangepicker/moment.min.js,__PUBLIC__/admin/js/bootstrap-daterangepicker/daterangepicker.js" /}
<section class="panel">
    <header class="panel-heading">
        供货商列表 <span class="label label-default">{$supplier_count}人</span><a class="btn btn-default tools pull-right" href="javascript:location.reload();"><span class="fa fa-refresh"></span></a>
    </header>
    <div class="panel-body">
        <div class="adv-table">
            <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline" role="grid">
                <div class="row">
                    <div class="col-xs-4 btn-group">
                        <a class="btn btn-default disabled" role="operate" data-type="1" data-url="{:WebUrl('adminsupplier/delsupplier')}"><i class="fa fa-trash-o"></i> 删除供货商</a>
                        <a class="btn btn-default disabled"  role="operate" data-type="2" data-url="{:WebUrl('adminsupplier/operatesupplier',array('is_black'=>1))}"><i class="fa fa-circle"></i> 拉黑供货商</a>
                        <a class="btn btn-default disabled"  role="operate" data-type="3" data-url="{:WebUrl('adminsupplier/operatesupplier',array('is_black'=>0))}"><i class="fa fa-circle-o"></i> 取消拉黑</a>
                    </div>
                    <div class="col-xs-4">
                        <form method="get">
                            <input type="text" name="key" class="form-control" value="{php} if(!empty($key)){ {/php}{$key}{php} } {/php}" placeholder="会员名/手机号">
                            <button type="submit" class="btn btn-default ">搜索</button>
                            <a class="btn btn-success ">导出</a>
                        </form>
                    </div>
                    <div class="col-xs-4 text-center">
                        <form method="get">
                            <input type="hidden" name="start_time" value="{:date('Y-m-d 00:00')}"/>
                            <input type="hidden" name="end_time" value="{:date('Y-m-d 23:59')}"/>
                            <input type="button" name="suppliertime" class="form-control " placeholder="按时间搜索" style="font-size: 12px;width: 240px;" >
                            <button type="submit" class="btn btn-default ">搜索</button>
                            <a class="btn btn-success ">导出</a>
                        </form>
                    </div>
                </div>
                <hr/>

                {php} if(!empty($supplier_list)){ {/php}
                <table class="table">
                    <thead>
                    <tr role="row">
                        <th><input type="checkbox" value=""></th>
                        <th>会员名</th>
                        <th>帐号(手机)</th>
                        <th>可提现余额</th>
                        <th>成交</th>
                        <th>最近登录</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody >
                    {php} foreach($supplier_list as $key=>$supplier){  {/php}
                    <tr >
                    <td><input type="checkbox" value="{$supplier['supplier_id']}"></td>
                    <td><img src="{:toHeadurl($supplier['supplier_avatar'])}" class="img-circle " width="40px" height="40px"> {:substr($supplier['supplier_name'],0,20)}</td>
                    <td>{$supplier['supplier_tel']}</td>
                    <td>
                        <p><span class="label label-info">{$supplier['available_predeposit']}元</span></p>
                    </td>
                    <td>
                        <p><span class="label label-success">订单: {$supplier['order_count']}</span></p>
                        <p><span class="label label-info">金额: {$supplier['order_sum']}元</span></p>
                    </td>
                    <td>
                        {:date('Y-m-d',$supplier['login_time'])}
                    </td>
                    <td>
                        <div class="btn-group">
                            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                操作 <span class="caret"></span>
                            </button>
                            <ul class="dropdown-menu" role="menu">
                                <li><a href="javascript:void(0);"><i class="fa fa-pencil-square-o"></i> 供货商编辑</a></li>
                                <li><a href="javascript:void(0);"><i class="fa fa-th-list"></i> 供货商订单</a></li>
                                <li><a href="javascript:void(0);"><i class="fa fa-trash-o"></i> 删除供货商</a></li>
                            </ul>
                        </div>
                    </td>
                    </tr>
                    {php} } {/php}
                    </tbody>
                </table>
                <div class="row-fluid">
                    <div class="span6 pull-right">
                        {$page}
                    </div>
                </div>
                {php} }else{ {/php}
                <div class="row text-center">暂无供货商....</div>
                {php} } {/php}

            </div>
        </div>
    </div>
</section>
<script type="text/javascript">
    $(document).ready(function () {
        dateInit('input[name="suppliertime"]','input[name="start_time"]','input[name="end_time"]');
        $('[role="operate"]').click(function () {
            var title = $(this).data('title');
            if(title){
                title = '您确认要执行此'+title+'操作吗？'
            }else{
                title = '您确认要执行此操作吗？'
            }
            $.confirm({
                icon:'fa fa-warning',
                title: '提醒',
                content: title ,
                buttons: {
                    ok: {
                        text: "确认",
                        btnClass: 'btn-success',
                        keys: ['enter'],
                        action: function(){
                            $.alert('dfdfdsf');
                            console.log('ok');
                        }
                    },
                    no:{
                        text: "取消",
                        btnClass: 'btn-default',
                        keys: ['enter'],
                        action: function(){
                            console.log('no');
                        }
                    },
                }
            });
        });
    });
</script>
